/* PPH管理界面浏览器兼容性样式 */
/* 支持 IE11+, Edge, Chrome, Firefox, Safari */

/* ==========================================================================
   IE11 兼容性修复
   ========================================================================== */

/* IE11 Flexbox 修复 */
.browser-ie .d-flex {
    display: -ms-flexbox !important;
    display: flex !important;
}

.browser-ie .flex-column {
    -ms-flex-direction: column !important;
    flex-direction: column !important;
}

.browser-ie .justify-content-between {
    -ms-flex-pack: justify !important;
    justify-content: space-between !important;
}

.browser-ie .align-items-center {
    -ms-flex-align: center !important;
    align-items: center !important;
}

/* IE11 渐变回退 */
.browser-ie .card-header,
.browser-ie .navbar {
    background: #667eea !important; /* 渐变回退色 */
}

.browser-ie .memory-used {
    background: #28a745 !important; /* 渐变回退色 */
}

/* IE11 Grid 回退 */
.browser-ie .row {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* ==========================================================================
   Safari 兼容性修复
   ========================================================================== */

.browser-safari .log-container {
    -webkit-overflow-scrolling: touch;
}

.browser-safari .table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Firefox 兼容性修复
   ========================================================================== */

.browser-firefox .btn {
    -moz-user-select: none;
}

/* ==========================================================================
   通用兼容性样式
   ========================================================================== */

/* 确保按钮在所有浏览器中一致 */
.btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border: 1px solid transparent;
    cursor: pointer;
}

/* 确保表格响应式在所有浏览器中工作 */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 确保卡片在所有浏览器中正确显示 */
.card {
    word-wrap: break-word;
    background-clip: border-box;
}

/* 确保模态框在所有浏览器中居中 */
.modal-dialog {
    margin: 1.75rem auto;
}

/* 移动端适配 */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .btn-group .btn {
        margin-bottom: 5px;
        width: 100%;
    }
    
    .log-container {
        height: 250px;
        font-size: 12px;
    }
    
    .table {
        font-size: 14px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
}

/* 平板适配 */
@media (min-width: 577px) and (max-width: 768px) {
    .col-md-3, .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .btn-group,
    .modal {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
    
    .log-container {
        background: white !important;
        color: black !important;
        border: 1px solid #000;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .card-header {
        background: #000 !important;
        color: #fff !important;
    }
    
    .btn-primary {
        background: #000 !important;
        border-color: #000 !important;
    }
    
    .status-online {
        color: #000 !important;
        font-weight: bold;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .memory-used,
    .btn,
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #2d3748 !important;
        border-color: #4a5568 !important;
        color: #e2e8f0 !important;
    }
    
    .table {
        color: #e2e8f0 !important;
    }
    
    .table th,
    .table td {
        border-color: #4a5568 !important;
    }
    
    .btn-outline-secondary {
        color: #e2e8f0 !important;
        border-color: #4a5568 !important;
    }
}

/* 焦点可见性增强 */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* 确保图标字体在所有浏览器中正确显示 */
.bi {
    font-family: "bootstrap-icons" !important;
    speak: never;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 确保加载动画在所有浏览器中工作 */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* IE11 动画回退 */
.browser-ie .spinner-border {
    border: 0.25em solid #6c757d;
    border-right-color: transparent;
}
